define(function (require, exports, module) {


    var Echarts = require("node_modules/echarts/3.7.2/index.js");

    require("andrew/show-code/index.js");

    var app = new Vue({
        el: '#app',
        data: {
            myChart: '',
            myChartOption: {
                title: {
                    text: '1111111'
                },
            }
        },
        mounted: function () {

            this.myChartOption = {
                title: {
                    text: 'ECharts 入门示例'
                },
                tooltip: {},
                legend: {
                    data: ['销量']
                },
                xAxis: {
                    data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
                },
                yAxis: {},
                series: [{
                    name: '销量',
                    type: 'bar',
                    data: [5, 20, 36, 10, 10, 20]
                }]
            };

            this.refresh();
        },
        watch: {
            myChartOption2: function (curVal, oldVal) {
                this.refresh();
            },
            myChartOption: {
                //注意：当观察的数据为对象或数组时，curVal和oldVal是相等的，
                //因为这两个形参指向的是同一个数据对象
                handler: function (curVal, oldVal) {
                    console.log(curVal, oldVal);
                    this.refresh();

                },
                deep: true
            }
        },
        methods: {
            test: function () {
                this.myChartOption.title.text = Math.random() * 10000;
            },
            refresh: function () {
                this.myChart = Echarts.init($("#one").get(0));
                this.myChart.setOption(this.myChartOption);
            }
        }

    });

});